the storage where all the contract state variables reside. The contracts have
their own storage and are persistent between function calls and quite
expensive to use. The second area is a memory that is used to hold
temporary values that get erased between function calls and are cheaper to
use. The third area is the stack that is used to hold small local variables,
almost free to use but can only hold a limited amount of values. You cannot
specify for almost all types where they should be stored because they are
copied every time they are used. But when you work with arrays or structs,
and from the latest versions with strings also, the compiler will force you to
specify the store area.
Function code
function get() public view return(string memory) {
return message;
function get()
public
view
return(string)
{
return message;
}
function set(string memory _message) public {
message = _message;
}
Kia.sol
Create—
Compile—
Deploy and Run Transaction
pragma solidity ^ 0.5.0;
contract K ia {
string message;
function get() public view returns(string memory)
{
return message;
}
function set(string memory _message) public
{
message = _message;